package com.wanho.java157.ProductManagement.service.Impl;

import com.wanho.java157.CustomerManagement.po.Customer;
import com.wanho.java157.ProductManagement.po.Orders;
import com.wanho.java157.ProductManagement.service.InventoryService;
import com.wanho.java157.ProductManagement.service.OrdersService;
import com.wanho.java157.SystemSetting.po.Employee;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.List;

import static org.junit.Assert.*;
@RunWith(SpringRunner.class)
@ContextConfiguration("classpath:spring/applicationContext.xml")
public class OrdersServiceImplTest {
    @Autowired
    private OrdersService ordersService;
    @Test
    public void selectByStatus() {
        List<Orders> orders = ordersService.selectByStatus("");
        System.out.println(orders);
    }

    @Test
    public void modify() {
        boolean b = ordersService.modifyStatusById("1", 1);
        System.out.println(b);
    }
    @Test
    public void search() {
        Orders orders = ordersService.selectById(1);
        System.out.println(orders);
    }
    @Test
    public void order1() {
        List<Orders> orders = ordersService.selectOrderByEmployee();
        System.out.println(orders);
    }

    @Test
    public void order2() {
        List<Orders> orders = ordersService.selectOrder("4");
        System.out.println(orders);
    }

    @Test
    public void add() {
        Orders orders=new Orders();
        orders.setTitle("test");
        orders.setTotalMoney(100);
        orders.setStatus("3");
        Employee employee=new Employee();
        employee.setEmployeeName("二团长");
        Customer customer=new Customer();
        customer.setCusName("某人");
        orders.setCustomer(customer);
        orders.setEmployee(employee);
        ordersService.addSales(orders);
    }


}